package co.wizardattack.connection;

import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;

public class NetworkUtility {

	public static String getIpAddr(WifiManager wifiManager) {
		WifiInfo wifiInfo = wifiManager.getConnectionInfo();
		int ip = wifiInfo.getIpAddress();

		String ipString = String.format(
				"%d.%d.%d.%d",
				(ip & 0xff),
				(ip >> 8 & 0xff),
				(ip >> 16 & 0xff),
				(ip >> 24 & 0xff));

		return ipString;
	}

}
